Re: [campsite-support] Images in index page
  • Hi Tim,

    You can either embed the images in the article content, using the xinha
    editor or through the template language:

    {{ list_article_images }}

    {{ /list_article_images }}

    However, the statement {{ uri options="image" }} doesn't work yet (in
    beta3). I'll let you know when I'm done implementing this statement.

    Mugur

    On Jan 10, 2008 7:58 PM, wrote:

    > Author: Tim Smith
    > Link: http://code.campware.org/phorum/read.php?8,6092,6092#msg-6092
    >
    > --------------------------------------------------------------------------------
    >
    > I'm having a hard time getting an image to appear in the index page.
    > Here's the template.
    >
    > {{ local }}
    > {{ set_section number="1" }}
    > {{ list_articles length="1" order="bynumber asc" name="articles" }}
    > article->name }}">{{ $campsite->article->name }}
    >
    > {{ $campsite->article->intro }}
    >
    >
    >
    >
    > {{ list_article_images }}
    >
    > {{ /list_article_images }}
    >
    >
    >
    >
    > {{ /list_articles }}
    > {{ /local }}
    >
    > When I view the source I get:
    >
    >
    > The NrImage value should have the value 1 but it's empty. When I do the
    > queries in CampGetImage.php I get the value 1.
    >
    > Am I going about getting the image for an associated article incorrectly?
    >
    > --
    > Sent from Campware Forums
    > http://code.campware.org/phorum
    >
  • 4 Comments sorted by
  • So for now, there is no way to get an image from an article to appear on the homepage or a section page?
  • Ah, wait, I see. If I put {{ $campsite->article->intro }} into my section template and the intro has the image, it will appear.
  • I decided that I wanted the image out of Intro and so I created a new field in the article called HighlightImage.

    I then went into an article and put the image into my new field called HighlightImage.

    I then changed my index.tpl to include the following:
    {{ $campsite->article->highlightimage }}

    However, the image does not get displayed on the index page.

    Is this a bug? When you add a new field, do you have to do something else in order to add a new field to a template?
  • Sorry, my mistake. I put my new field, {{ $campsite->article->highlightimage }} , in the wrong place in the template. I put it outside the {{ list_articles }}.

    Sorry about that.